package com.software.levelupserver.mappers;

import com.software.levelupserver.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

import java.util.List;

public interface UserMapper {
    User getUserByEmail(@Param("email") String email);
    User findUserByUserId(@Param("userId") int userId);
    int countUsersByLoginTime(@Param("loginTime") String loginTime); //获取该日期下的活跃用户数量
    int countUsers(); //获取用户总数

    int addUser(@Param("user") User user);

    int updatePassword(@Param("password") String password,@Param("email") String email);
    int updateUser(@Param("user") User user, @Param("avatar") String avatar);

    List<User> findAllUsers(@Param("pageNum")Integer pageNum,@Param("pageSize")Integer pageSize);
    List<User> findAllUsers();
    int deleteUserById(@Param("userId")Integer userId);
	boolean updateUserLoginTime(@Param("loginTime") String loginTime, @Param("userId") int userId) ;
    boolean updateExperience(@Param("experience") double experience, @Param("userId") int userId); //更新用户的经验值
    boolean updateGrade(@Param("gradeId") int gradeId , @Param("userId") int userId); //更新用户等级（即升级）

}
